let user = {name:'Sunny', interests:['Traveling', 'Swimming']};
let {name, interests, tasks} = user;  //结构对象

console.log(name);       // Sunny
console.log(interests);  // ["Traveling", "Swimming"]
console.log(tasks);      // undefined

//可以取不同的名字
let {name: firstName} = user;
console.log(firstName);


//可以设置不存在时候的默认值
let {tasks1=[]} = user;  //结构对象
console.log(tasks1);


